//
//  ConsulationFunc1Cell.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/10/31.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "ConsulationFunc1Cell.h"

@interface ConsulationFunc1Cell ()

/// viewModle
@property (nonatomic, readwrite, strong) ConsulationFunc1CellModel *viewModel;

/// IBOutlet
@property (weak, nonatomic) IBOutlet UIView* searchView;
@property (weak, nonatomic) IBOutlet UIButton* askBtn;
@property (weak, nonatomic) IBOutlet UIButton* expertBtn;
@property (weak, nonatomic) IBOutlet UIButton* searchBtn;

@end

@implementation ConsulationFunc1Cell

- (void)awakeFromNib
{
    [super awakeFromNib];
    // Initialization code
    
    self.searchView.layer.cornerRadius = self.searchView.frame.size.height/2.0f;
    self.searchView.layer.masksToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

#pragma mark - bind data
- (void)bindViewModel:(ConsulationFunc1CellModel *)viewModel
{
    if (self.viewModel)
        return;
    
    self.viewModel = viewModel;
    
    @weakify(self);
    
    [[self.askBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
        
        @strongify(self);
        
        [self.viewModel.askCmd execute:nil];
    }];
    [[self.expertBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
        
        @strongify(self);
        
        [self.viewModel.expertCmd execute:nil];
    }];
    [[self.searchBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
        
        @strongify(self);
        
        [self.viewModel.searchCmd execute:nil];
    }];
}

@end
